<template>
	<view class="withdrawalRecords">
		<view class="card-money">
			<view class="card-money-view">
				<view class="card-money-title">￥{{amount?amount:0}}</view>
				<view class="showMessage-btn" @click="Withdrawal">提现</view>
			</view>
		</view>
		<view class="card-money-list" v-if="moneyDatail.length > 0">
			<view class="card-money-item" v-for="(item,index) in moneyDatail" :key="index">
				<view class="reward-item-left">
					<view class="card-moneyItem-desc">
						{{item.create_time}}
					</view>
					<view class="card-moneyItem-item">
						{{item.remark}}
					</view>
				</view>
				<view class="reward-item-right">
					<text style="font-size: 15px;"></text>￥{{item.amount}}
				</view>
			</view>
		</view>
		<view v-else style="margin-top: 200rpx;">
			<u-empty text="暂无保障金" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	import $T from "@/utils/time.js"
	export default {
		data() {
			return {
				moneyDatail: [],
				type: 7,
				amount: 0,
				flag: true,
				page: 1,
			}
		},
		filters: {
			getTime(val) {
				return $T.gettime(val)
			}
		},
		onLoad(option) {
			this.amount = option.allowance_money
		},
		// 触底刷新
		onReachBottom() {
			if (this.flag) {
				this.amountDetail()
			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1
			this.flag = true
			this.moneyDatail = []
			this.amountDetail()
			uni.stopPullDownRefresh();
		},
		onShow() {
			this.amountDetail()
		},
		methods: {
			Withdrawal() {
				uni.navigateTo({
					url: '/pages/mine/mine-list/Withdrawal?type=' + this.type + '&name=保障金' + '&amount=' + this
						.amount
				})
			},
			amountDetail() {
				this.$http.post(this.$api.allowanceList, {
					Page: this.page
				}, {
					token: true
				}).then(res => {
					if (res.data.last_page > res.data.current_page) {
						this.page++;
						this.moneyDatail.push(...res.data.data)
					} else {
						this.flag = false
						this.moneyDatail = res.data.data
					}
					
				})
			}
		}
	}
</script>

<style lang="scss">
	.withdrawalRecords {
		overflow: hidden;
		background-color: #D8EBFF;
		min-height: 100vh;
	}

	.daily-title {
		padding: 30rpx;
		display: flex;
		align-items: center;

		.daily-title-view {
			font-size: 15px;
			color: #333333;
			position: relative;
			flex: 30%;
			display: flex;
			align-items: center;
			justify-content: center;

			.daily-active {
				position: absolute;
				bottom: 15rpx;
				left: 80rpx;
				width: 56rpx;
				height: 14rpx;

				.active-image {
					width: 100%;
					height: 100%;
				}
			}
		}
	}

	.card-money-list {
		padding: 0 30rpx 30rpx 30rpx;

		.card-money-item {
			padding: 0rpx 30rpx 30rpx 30rpx;
			background-color: #ffffff;
			margin-bottom: 30rpx;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.reward-item-left {
				.card-moneyItem-desc {
					color: #333333;
					font-size: 15px;
					padding: 20rpx 0;
				}

				.card-moneyItem-item {
					font-size: 15px;
					color: #666666;
				}
			}

			.reward-item-right {
				font-size: 20px;
				color: #E83434;
			}

		}
	}

	.card-money {
		padding: 30rpx;

		.card-money-view {
			background: url('../../../static/mine/39.png') no-repeat;
			background-size: 100% 100%;
			border-radius: 30rpx;
			padding: 60rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;

			.card-money-title {
				font-size: 24px;
				color: #ffffff;
				margin-bottom: 30rpx;
			}

			.showMessage-btn {
				background: url('../../../static/mine/40.png')no-repeat;
				background-size: 100% 100%;
				padding: 10rpx 40rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 15px;
				letter-spacing: 4rpx;
				color: #333333;
			}
		}
	}
</style>